<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../css/table.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery-1.8.3.min.js"></script>
<script>
		$(function(){
			loadType();
		});
		
		function loadType(){
			
			$.post('../getByPIDRight.action',{'right.parentid':''},function(data){
					for(var i=0;i<data.length;i++){
						$('#parentid').append('<option value="'+data[i].id+'">'+data[i].name+'</option>');
				}
			},'json');
			
			$('#save').click(function(){
				add();	
			});
			
		}
		
		function add(){
			$.post('../addRight.action',{'right.rid':$('#rid').val(),'right.parentid':$('#parentid').val(),'right.rname':$('#rname').val(),'right.rurl':$('#rurl').val(),'right.ztype':$('#ztype').val()},function(data){
				if(data=='1'){
					var ok = confirm('添加成功！,是否继续添加？');
					if(ok==true){
						$('#form1')[0].reset();
					}else{
						location.href='index.html';	
					}
				}else{
					alert('添加失败！,请检查输入,可能是您输入的编号已存在！');
				}
			});	
		}
		
</script>
</head>

<body>
<div class="table_full">
<form id="form1">
  <table width="550" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td width="120" class="table_rightf">编号：</td>
      <td class="tableleftf"><label for="right.rid"></label>
      <input type="text" name="right.rid" id="rid" />
      (不填，系统自动生成)</td>
    </tr>
    <tr>
      <td class="table_rightf">父权限：</td>
      <td class="tableleftf"><label for="right.parentid"></label>
        <select name="right.parentid" id="parentid">
          <option value="">无</option>
      </select></td>
    </tr>
    <tr>
      <td class="table_rightf">名称：</td>
      <td class="tableleftf"><label for="right.rname"></label>
      <input type="text" name="right.rname" id="rname" />
      *</td>
    </tr>
    <tr>
      <td class="table_rightf">URL:</td>
      <td class="tableleftf"><label for="right.rurl"></label>
      <input type="text" name="right.rurl" id="rurl" />
      （相对）*</td>
    </tr>
    <tr>
      <td class="table_rightf">菜单可见：</td>
      <td class="tableleftf"><label for="right.ztype"></label>
        <select name="right.ztype" id="ztype">
          <option value="false" selected="selected">可见</option>
          <option value="true">不可见</option>
        </select></td>
    </tr>
    <tr>
      <td class="table_rightf">&nbsp;</td>
      <td><span class="tableleftf">
        <input type="button" name="button" id="save" value="  保 存  " />
      </span></td>
    </tr>
    <tr>
      <td class="table_rightf">&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
  </form>
</div>
</body>
</html>
